import java.util.ArrayList;
import java.util.Iterator;

public class Student {

	private String name;
	private String surname;
	private String studNumber;
	private String course;
	private String department;
	private String address;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getStudNumber() {
		return studNumber;
	}

	public void setStudNumber(String studNumber) {
		this.studNumber = studNumber;
	}

	public String getCourse() {
		return course;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", surname=" + surname
				+ ", studNumber=" + studNumber + ", course=" + course
				+ ", department=" + department + ", address=" + address + "]";
	}

	public ArrayList<Student> findStudentByNumber(String studNumber,
			ArrayList<Student> students) {

		ArrayList<Student> students2 = new ArrayList<Student>();
		for (Student student : students) {
			if(student.getStudNumber().equals(studNumber) ) {
				students2.add(student);
			}

		}

		return students2;
	}

	public ArrayList<Student> deleteStudentByNumber(String studentNumber, ArrayList<Student> students) {

		Student student;
		Iterator<Student> itr = students.iterator();

		while (itr.hasNext()) {
			student = new Student();
			student = (Student) itr.next();
			if (student.getStudNumber().equals(studentNumber) ) {
				itr.remove();
			}
		}

		return students;
	}

	public ArrayList<Student> updateMoviesCollection( ArrayList<Student> students, Student studentModelParam)
	{
		Student student;
		Iterator<Student> itr = students.iterator();
		int i = 0;
		while (itr.hasNext()) {
			student = new Student();
			student = (Student) itr.next();
			if (student.getStudNumber() == studentModelParam.getStudNumber()) {
				students.set(i, studentModelParam);
			}
			i++;
		}

		return students;
	}
}
